home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 50
/
Volume 50 - JOGO DISK .iso
/
Games
/
moonstonemadness.swf
/
scripts
/
__Packages
/
Library
/
Utils
/
Timer.as
< prev
next >
Wrap
Text File
|
2007-09-27
|
1KB
|
53 lines
class Library.Utils.Timer
{
static var TIMER_COUNT_UP = 1;
static var TIMER_COUNT_DOWN = -1;
static var BASE_FRAMERATE = 30;
function Timer()
{
this.nTimeSpent = 0;
this.nMethod = Library.Utils.Timer.TIMER_COUNT_UP;
this.nFrameRate = Library.Utils.Timer.BASE_FRAMERATE;
this.bTimerActive = false;
}
function doEnterFrame()
{
if(this.bTimerActive)
{
this.nTimeSpent += this.nMethod;
}
}
function doStartTimer()
{
this.bTimerActive = true;
}
function doStopTimer()
{
this.bTimerActive = false;
}
function setTime(__nTime)
{
this.nTimeSpent = __nTime * (this.nFrameRate / 1000);
}
function doResetTime()
{
this.nTimeSpent = 0;
}
function get Time()
{
return Math.round(this.nTimeSpent / (this.nFrameRate / 1000));
}
function get Frames()
{
return this.nTimeSpent;
}
function set Method(__n)
{
this.nMethod = __n;
}
function set FrameRate(__n)
{
this.nFrameRate = __n;
}
}